package com.szrt.ch04.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.szrt.ch04.dao.UserDao;
import com.szrt.ch04.dao.impl.UserDaoImpl;
import com.szrt.ch04.dto.PageDTO;
import com.szrt.ch04.entity.UserEntity;
import com.szrt.ch04.service.UserService;

public class UserServiceImpl implements UserService {
	
	private UserDao  dao = new UserDaoImpl();

	@Override
	public Map<String, Object> findWithPage(PageDTO page) {
		
		Map<String, Object> map  = new HashMap<String, Object>();
		
		List<UserEntity> list;
		try {
			list = dao.findWithPage(page);
			
			//记录成功的日志  info
			map.put("result", "success");
			map.put("currentPage", page.getCurrentPage());
			map.put("list", list);
		} catch (Exception e) {
			//记录成功的日志 error
			map.put("result", "failure");
			e.printStackTrace();
		}
		//公司开发标准手段
		return map;
	}

}
